From: Andrew Cooper Date: Thu, 7 Nov 2013 14:17:48 +0000 (+0100) Subject: x86/msi: Refactor msi_compose_message() to not require an irq_desc X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~6050 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ac6e1ae87b229f452fa5859bf95dc51459eaeb68;p=xen.git x86/msi: Refactor msi_compose_message() to not require an irq_desc Subsequent changes will cause HPET MSIs to not have an associated IRQ. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Reviewed-by: Tim Deegan --- diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index 4373791729..3a4f7e8049 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -331,7 +331,7 @@ static int __hpet_setup_msi_irq(struct irq_desc *desc) { struct msi_msg msg; - msi_compose_msg(desc, &msg); + msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg); return hpet_msi_write(desc->action->dev_id, &msg); } diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index b43c36a1c6..284042e19d 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -124,13 +124,12 @@ static void msix_put_fixmap(struct arch_msix *msix, int idx) /* * MSI message composition */ -void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg) +void msi_compose_msg(unsigned vector, const cpumask_t *cpu_mask, struct msi_msg *msg) { unsigned dest; - int vector = desc->arch.vector; memset(msg, 0, sizeof(*msg)); - if ( !cpumask_intersects(desc->arch.cpu_mask, &cpu_online_map) ) { + if ( !cpumask_intersects(cpu_mask, &cpu_online_map) ) { dprintk(XENLOG_ERR,"%s, compose msi message error!!\n", __func__); return; } @@ -138,7 +137,7 @@ void msi_compose_msg(struct irq_desc *desc, struct msi_msg *msg) if ( vector ) { cpumask_t *mask = this_cpu(scratch_mask); - cpumask_and(mask, desc->arch.cpu_mask, &cpu_online_map); + cpumask_and(mask, cpu_mask, &cpu_online_map); dest = cpu_mask_to_apicid(mask); msg->address_hi = MSI_ADDR_BASE_HI; @@ -491,7 +490,7 @@ int __setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc, desc->msi_desc = msidesc; desc->handler = handler; - msi_compose_msg(desc, &msg); + msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg); return write_msi_msg(msidesc, &msg); } diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 2dbe97a7d1..97d5b5e746 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -1039,7 +1039,7 @@ static void dma_msi_set_affinity(struct irq_desc *desc, const cpumask_t *mask) return; } - msi_compose_msg(desc, &msg); + msi_compose_msg(desc->arch.vector, desc->arch.cpu_mask, &msg); /* Are these overrides really needed? */ if (x2apic_enabled) msg.address_hi = dest & 0xFFFFFF00; diff --git a/xen/include/asm-x86/msi.h b/xen/include/asm-x86/msi.h index 9eeef63935..89a9266ca9 100644 --- a/xen/include/asm-x86/msi.h +++ b/xen/include/asm-x86/msi.h @@ -231,7 +231,8 @@ struct arch_msix { }; void early_msi_init(void); -void msi_compose_msg(struct irq_desc *, struct msi_msg *); +void msi_compose_msg(unsigned vector, const cpumask_t *mask, + struct msi_msg *msg); void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable); void mask_msi_irq(struct irq_desc *); void unmask_msi_irq(struct irq_desc *);